package com.ruoyi.ky450.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.ky450.domain.EquipAircraft;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ky450.mapper.EquipArmoredVehicleMapper;
import com.ruoyi.ky450.domain.EquipArmoredVehicle;
import com.ruoyi.ky450.service.IEquipArmoredVehicleService;
import org.springframework.util.CollectionUtils;

/**
 * 装甲车Service业务层处理
 *
 * @author ruoyi
 * @date 2025-01-16
 */
@Slf4j
@Service(value = "EquipArmoredVehicleServiceImpl")
public class EquipArmoredVehicleServiceImpl extends EquipParentService implements IEquipArmoredVehicleService
{
    @Autowired
    private EquipArmoredVehicleMapper equipArmoredVehicleMapper;

    /**
     * 查询装甲车
     *
     * @param id 装甲车主键
     * @return 装甲车
     */
    @Override
    public EquipArmoredVehicle selectEquipArmoredVehicleById(Long id)
    {
        return equipArmoredVehicleMapper.selectEquipArmoredVehicleById(id);
    }

    @Override
    public EquipArmoredVehicle getByEBInfoId(Long id) {
        EquipArmoredVehicle equipArmoredVehicle = new EquipArmoredVehicle();
        equipArmoredVehicle.setEquipBaseInfoId(id);
        List<EquipArmoredVehicle> list = this.selectEquipArmoredVehicleList(equipArmoredVehicle);
        if(!CollectionUtils.isEmpty(list)){
            return list.get(0);
        }
        return null;
    }

    /**
     * 查询装甲车列表
     *
     * @param equipArmoredVehicle 装甲车
     * @return 装甲车
     */
    @Override
    public List<EquipArmoredVehicle> selectEquipArmoredVehicleList(EquipArmoredVehicle equipArmoredVehicle)
    {
        return equipArmoredVehicleMapper.selectEquipArmoredVehicleList(equipArmoredVehicle);
    }

    /**
     * 新增装甲车
     *
     * @param equipArmoredVehicle 装甲车
     * @return 结果
     */
    @Override
    public int insertEquipArmoredVehicle(EquipArmoredVehicle equipArmoredVehicle)
    {
        equipArmoredVehicle.setCreateTime(DateUtils.getNowDate());
        return equipArmoredVehicleMapper.insertEquipArmoredVehicle(equipArmoredVehicle);
    }

    /**
     * 修改装甲车
     *
     * @param equipArmoredVehicle 装甲车
     * @return 结果
     */
    @Override
    public int updateEquipArmoredVehicle(EquipArmoredVehicle equipArmoredVehicle)
    {
        equipArmoredVehicle.setUpdateTime(DateUtils.getNowDate());
        return equipArmoredVehicleMapper.updateEquipArmoredVehicle(equipArmoredVehicle);
    }

    /**
     * 批量删除装甲车
     *
     * @param ids 需要删除的装甲车主键
     * @return 结果
     */
    @Override
    public int deleteEquipArmoredVehicleByIds(Integer[] ids)
    {
        return equipArmoredVehicleMapper.deleteEquipArmoredVehicleByIds(ids);
    }

    /**
     * 删除装甲车信息
     *
     * @param id 装甲车主键
     * @return 结果
     */
    @Override
    public int deleteEquipArmoredVehicleById(Long id)
    {
        return equipArmoredVehicleMapper.deleteEquipArmoredVehicleById(id);
    }
}
